import datetime

#几个用来计算日期的函数

def next_day(date,num):
    res = datetime.datetime.strptime(date, '%Y-%m-%d') + datetime.timedelta(days=num)
    return datetime.datetime.strftime(res, '%Y-%m-%d')

def prev_day(date,num):
    res = datetime.datetime.strptime(date, '%Y-%m-%d') - datetime.timedelta(days=num)
    return datetime.datetime.strftime(res, '%Y-%m-%d')

def isLater(a_date,b_date):
    a = datetime.datetime.strptime(a_date, '%Y-%m-%d')
    b = datetime.datetime.strptime(b_date, '%Y-%m-%d')
    diff = b-a
    return diff.days>0

def date_diff(a_date,b_date):
    a = datetime.datetime.strptime(a_date, '%Y-%m-%d')
    b = datetime.datetime.strptime(b_date, '%Y-%m-%d')
    diff = b-a
    return abs(diff.days)